aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/fund/[id]
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-11-25 09:50:53 -0700
committerAdam Soltys <[email protected]>2026-11-25 09:50:53 -0700
commit3a321d4e70d1244224c4643ddac8e96216bfe5f4 (patch)
treea4996d39e4aa1acbfae66bc9aefc0a931c2e8a71 /src/routes/(app)/fund/[id]
parent032f5038e17afb80cd704b8363b8c3c8688e16b6 (diff)
downloadcoinos-ui-3a321d4e70d1244224c4643ddac8e96216bfe5f4.tar.gz
coinos-ui-3a321d4e70d1244224c4643ddac8e96216bfe5f4.zip
Fund page: show history read-only with a "discontinued" notice
Funds are closed, but a fund link fell through to the generic error page. Send the viewer's token so managers can still open a fund's history, drop the manage and share controls, and explain that funds are discontinued instead of showing an error. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6W9CsdxmhFrfaKNVHU
Diffstat (limited to 'src/routes/(app)/fund/[id]')
-rw-r--r--src/routes/(app)/fund/[id]/+layout.server.ts22
-rw-r--r--src/routes/(app)/fund/[id]/+page.svelte36
2 files changed, 26 insertions, 32 deletions
diff --git a/src/routes/(app)/fund/[id]/+layout.server.ts b/src/routes/(app)/fund/[id]/+layout.server.ts
index 3669eb7d..fb78b771 100644
--- a/src/routes/(app)/fund/[id]/+layout.server.ts
+++ b/src/routes/(app)/fund/[id]/+layout.server.ts
@@ -1,12 +1,24 @@
import getRates from "$lib/rates";
-import { get } from "$lib/utils";
+import { auth, get } from "$lib/utils";
-export const load = async ({ depends, params: { id }, parent }) => {
+// Funds are discontinued: the page is a read-only view of a fund's history.
+// Fetch with the viewer's token so a manager opening a pre-rotation link is
+// served the rotated fund, and fall back to a "discontinued" notice instead of
+// the generic error page when the fund can't be shown.
+export const load = async ({ cookies, depends, params: { id }, parent }) => {
depends("app:payments");
- const data = await get(`/fund/${id}`);
- data.managers = await get(`/fund/${id}/managers`);
- const rates = await getRates();
const { user } = await parent();
+ const headers = user ? auth(cookies) : {};
+
+ let data;
+ try {
+ data = await get(`/fund/${id}`, headers);
+ data.managers = await get(`/fund/${data.id || id}/managers`);
+ } catch (e) {
+ data = { notFound: true, amount: 0, payments: [], managers: [] };
+ }
+
+ const rates = await getRates();
data.rate = rates[user?.currency || "USD"];
return data;
};
diff --git a/src/routes/(app)/fund/[id]/+page.svelte b/src/routes/(app)/fund/[id]/+page.svelte
index a22e4b93..2b1f1479 100644
--- a/src/routes/(app)/fund/[id]/+page.svelte
+++ b/src/routes/(app)/fund/[id]/+page.svelte
@@ -14,7 +14,7 @@
let { data } = $props();
- let { amount, payments, managers, rate, user } = data;
+ let { amount, payments, managers, rate, user, notFound } = data;
let { id } = $page.params;
let locale = loc(user);
@@ -37,6 +37,13 @@
<div
class="md:shadow-xl rounded-3xl md:px-10 pt-5 pb-10 space-y-5 w-full md:mx-5"
>
+ <div class="alert alert-warning text-left">
+ <iconify-icon icon="ph:info-bold" width="24"></iconify-icon>
+ <span>
+ {notFound ? $t("funds.discontinuedNotFound") : $t("funds.discontinued")}
+ </span>
+ </div>
+ {#if !notFound}
{#if show}
<div class="max-w-[360px] mx-auto">
<img
@@ -68,34 +75,9 @@
<div>{$t("funds.anyone")}</div>
{/if}
</div>
-
- {#if (user && !managers.length) || managers.some((m) => m.id === user?.id)}
- <a
- href={`/fund/${id}/access`}
- class="btn !w-auto ml-auto text-secondary grow"
- >
- <iconify-icon icon="ph:gear-bold" width={32}></iconify-icon>
- {$t("funds.manage")}
- </a>
- {/if}
- </div>
- <div class="flex gap-2" data-sveltekit-prefetch="off">
- <a href={`/qr/${href}`} class="btn !w-auto grow">
- <iconify-icon noobserver icon="ph:link-bold" width="32"
- ></iconify-icon>
- <div class="my-auto">{$t("payments.shareLink")}</div>
- </a>
- <!-- <a href={`/qr/${lnurlw}`} class="btn !w-auto grow"> -->
- <!-- <iconify-icon -->
- <!-- noobserver -->
- <!-- icon="ph:lightning-fill" -->
- <!-- width="24" -->
- <!-- class="text-yellow-300" -->
- <!-- ></iconify-icon> -->
- <!-- {$t("payments.lnurlw")} -->
- <!-- </a> -->
</div>
<Payments {payments} fund={true} {locale} {user} />
+ {/if}
</div>
</div>
</div>